{extend name="index"/}
{block name="title"}后台管理 - {:sysconf('title')}{/block}
{block name="content"}
<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> <a href="{:url('Index/index')}">首页</a> <span class="c-gray en">&gt;</span> 财务管理 <span class="c-gray en">&gt;</span> 消费记录<a id="btn-refresh" class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <form action="">
                <div class="text-c">
                    日期范围：
                    <input type="text" onfocus="WdatePicker()" value="{:input('logmin')}" name="logmin" class="input-text Wdate" style="width:120px;">
                    -
                    <input type="text" onfocus="WdatePicker()" value="{:input('logmax')}" name="logmax" class="input-text Wdate" style="width:120px;">
                    关键字:
                    <input type="text" value="{:input('keywords')}" name="keywords" class="input-text" style="width:120px;">
                    商品ID:
                    <input type="text" value="{:input('goodsId')}" name="goodsId" class="input-text" style="width:120px;">
                    <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
                </div>
            </form>
            <div class="mt-20">
                <table class="table table-border table-bordered table-hover table-bg table-sort">
                    <thead>
                    <tr class="text-c">
                        <th width="40">ID</th>
                        <th width="100">订单号</th>
                        <th width="60">用户</th>
                        <th width="100">商品标题</th>
                        <th width="40">商品金额</th>
                        <th width="40">商品数量</th>
                        <th width="60">总额</th>
                        <th width="100">下单时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="val"}
                    <tr class="text-c">
                        <td>{$val['id']}</td>
                        <td>{$val['order_no']}</td>
                        <td>{$val['nickname']} - - {$val['true_name']}</td>
                        <td>{$val['goods_title']}</td>
                        <td>{$val['goods_sell_price']}</td>
                        <td>{$val['goods_count']}</td>
                        <td>{$val['goods_sell_price'] * $val['goods_count']}</td>
                        <td>{$val['add_time']}</td>
                    </tr>
                    {/volist}
                    <tr class="text-c"> <td colspan="2"><span style="color:red">总金额</span></td><td colspan="2">{$priceSum}元</td><td colspan="2"><span style="color:red">总数量</span></td><td colspan="2">{$countSum}个</td></tr>
                    </tbody>
                </table>
                <div class="bjwl_paginate">
                    {$list->render()}
                </div>
            </div>
        </article>
    </div>
</section>
<script type="text/javascript" src="__LIB__/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__LIB__/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__LIB__/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    /*$(function(){
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,8]}// 制定列不参与排序
            ]
        });
        $('.table-sort tbody').on( 'click', 'tr', function () {
            if ( $(this).hasClass('selected') ) {
                $(this).removeClass('selected');
            }
            else {
                $('tr.selected').removeClass('selected');
                $(this).addClass('selected');
            }
        });
    });*/
    /*添加*/
    function goods_add(title,url,w,h){
        layer_show_full(title,url,w,h);
    }
    /*停用*/
    function cash_fail(obj,id){
        layer.confirm('确认转账失败吗？',function(index){
            var cashId=id;
            $.ajax({
                url:"{:url('Finance/make')}",
                type:'post',
                data:{
                    'cashId':cashId,
                    'action':'fail'
                },
                dataType:'json',
                success:function(data){
                    if(data.code==0)
                    {
                        $(obj).parents("tr").find(".td-status").html('<span class="label label-danger radius">转账失败</span>');
                        layer.msg(data.msg,{icon:6,time:1000});
                    }
                    else{
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                },
                error:function(data){
                    layer.msg(data.msg,{icon:5,time:1000});
                }
            });
        });
    }
    /*启用*/
    function cash_success(obj,id){
        layer.confirm('确认转账成功吗？',function(index){
            var cashId=id;
            $.ajax({
                url:"{:url('Finance/make')}",
                type:'post',
                data:{
                    'cashId':cashId,
                    'action':'success'
                },
                dataType:'json',
                success:function(data){
                    if(data.code==0)
                    {
                        $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已转账</span>');
                        layer.msg(data.msg,{icon:6,time:1000});
                    }
                    else{
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                },
                error:function(data){
                    layer.msg(data.msg,{icon:5,time:1000});
                }
            });
        });
    }
    /*删除*/
    function cash_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            var cashId=id;
            $.ajax({
                url:"{:url('Finance/del')}",
                type:'post',
                data:{
                    'cashId':cashId
                },
                dataType:'json',
                success:function(data){
                    if(data.code==0)
                    {
                        $(obj).parents("tr").remove();
                        layer.msg(data.msg,{icon:6,time:1000});
                    }
                    else{
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                },
                error:function(data){
                    layer.msg(data.msg,{icon:5,time:1000});
                }
            });
        });
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}